<!doctype html>
<html lang="zh">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>发布寻物/寻主启示</title>
  <link rel="stylesheet" type="text/css" href="__STATIC__/bootstrap/css/bootstrap.min.css">
<style type="text/css">
.main{
  padding-top: 60px;
}
 .footer{
        text-align: center;
        margin-top: 20px;
    }
    . footer p{
        color:#3F3838

    }
</style>
  <!--[if IE]>
    <script src="http://libs.useso.com/js/html5shiv/3.7/html5shiv.min.js"></script>
  <![endif]-->

</head>
<body>
  <include file="Public/nav"/>
    <div class="container">
      <div class="main">
  <input type="hidden" value="{$username}" id="username1">
  
    <ul class="nav nav-tabs" role="tablist" id="mytab">
      <li role="presentation" class="active"><a href="#xunwu" aria-controls="home" role="tab" data-toggle="tab">寻物</a></li>
      <li role="presentation"><a href="#xunzhu" aria-controls="profile" role="tab" data-toggle="tab">寻主</a></li>
    </ul>

    <!-- Tab panes -->
    <div class="tab-content">

      <!--寻物-->
      <div role="tabpanel" class="tab-pane active" id="xunwu">
        <div class="form-group">
            <form action="{:U('Home/Post/lost_upload')}" enctype="multipart/form-data" method="post" onSubmit="return checkPost(1)">
              <label for="name1">丢失的物品名</label>
            <input class="form-control" type="text" id="name1" placeholder="物品名称" name="name1" >
            <label for="place1">丢失物品的地方</label>
            <select class="form-control" id="place1" name="place1">
              <option value="泰山">泰山</option>
              <option value="华山">华山</option>
              <option value="启林">启林</option>
              <option value="六一">六一</option>
              <option value="黑山">黑山</option>
            </select>
            <label for="lost_time1">丢失物品的时间</label>
            <select class="form-control" id="lost_time1" name="lost_time1">
              <option value="{$today}">
                {$today}
              </option>
              <option value="{$yesterday}">
                {$yesterday}
              </option>
              <option value="{$twoDaysAgo}">
                {$twoDaysAgo}
              </option>
              <option value="{$threeDaysAgo}">
                {$threeDaysAgo}
              </option>
              <option value="{$fourDaysAgo}">
                {$fourDaysAgo}
              </option>
              <option value="{$fiveDaysAgo}">
                {$fiveDaysAgo}
              </option>
              <option value="更早之前">
                更早之前
              </option>
            </select>
            <label for="kind1">丢失物品的种类</label>
            <select class="form-control" id="kind1" name="kind1"> 
              <option value="{$id[0]['id']}">{$name[0]['name']}</option> 
              <option value="{$id[1]['id']}">{$name[1]['name']}</option> 
              <option value="{$id[2]['id']}">{$name[2]['name']}</option> 
              <option value="{$id[3]['id']}">{$name[3]['name']}</option> 
              <option value="{$id[4]['id']}">{$name[4]['name']}</option> 
              <option value="{$id[5]['id']}">{$name[5]['name']}</option> 
              <option value="{$id[6]['id']}">{$name[6]['name']}</option> 
            </select>
            <label for="description1">丢失的物品详细描述</label>
            <textarea class="form-control" rows="4" name="description1" id="description1" placeholder="详细描述"></textarea>
            <label for="contact1">联系方式</label>
            <input class="form-control" type="text" name="contact1" id="contact1" placeholder="长号短号qq等(注明是具体哪种联系方式)">
            <label for="adward1">悬赏方式(可不填)</label>
            <select class="form-control" id="adward1" name="adward1" placeholder="悬赏"> 
              <option value=""></option>
              <option value="酸奶">酸奶</option>
              <option value="宵夜">宵夜</option>
              <option value="桑果汁">桑果汁</option>
              <option value="手机号">手机号</option>
              <option value="qq号">qq号</option>
              <option value="微信号号">微信号</option>
              <option value="香吻">香吻</option>
            </select>
            <input class="form-control" name="addition1" type="text" value="" placeholder="补充的悬赏(可不填)" >
              <label for="uploadPhotos">上传失物图片(最多五张，每张不得超过3M)</label>
              <input class="form-inline" style="width:300px;height:30px;" type="file" name="photo1">
              <input class="form-inline" style="width:300px;height:30px;" type="file" name="photo2">
              <input class="form-inline" style="width:300px;height:30px;" type="file" name="photo3">
              <input class="form-inline" style="width:300px;height:30px;" type="file" name="photo4">
              <input class="form-inline" style="width:300px;height:30px;" type="file" name="photo5">
              <input class="btn btn-info uploadbtn" id="lost_upload" type="submit" value="上传">
            </form>
        </div>
      </div>
       
      <!--寻主-->
      <div role="tabpanel" class="tab-pane" id="xunzhu">
          <div class="form-group">
         <form action="{:U('Home/Post/found_upload')}" enctype="multipart/form-data" method="post" onSubmit="return checkPost(2)">
            <label for="name2">捡到的物品名</label>
            <input class="form-control" type="text" id="name2" name="name2" placeholder="物品名称">
            <label for="place2">捡到物品的地方</label>
            <select class="form-control" id="place2" name="place2">
              <option value="泰山">泰山</option>
              <option value="华山">华山</option>
              <option value="启林">启林</option>
              <option value="六一">六一</option>
              <option value="黑山">黑山</option>
            </select>
            <label for="lost_time2">捡到物品的时间</label>
            <select class="form-control" id="lost_time2" name="lost_time2">
              <option value="{$today}">
                {$today}
              </option>
              <option value="{$yesterday}">
                {$yesterday}
              </option>
              <option value="{$twoDaysAgo}">
                {$twoDaysAgo}
              </option>
              <option value="{$threeDaysAgo}">
                {$threeDaysAgo}
              </option>
              <option value="{$fourDaysAgo}">
                {$fourDaysAgo}
              </option>
              <option value="{$fiveDaysAgo}">
                {$fiveDaysAgo}
              </option>
              <option value="更早之前">
                更早之前
              </option>
            </select>
            <label for="kind2">捡到物品的种类</label>
            <select class="form-control" id="kind2" name="kind2"> 
              <option value="{$id[0]['id']}">{$name[0]['name']}</option> 
              <option value="{$id[1]['id']}">{$name[1]['name']}</option> 
              <option value="{$id[2]['id']}">{$name[2]['name']}</option> 
              <option value="{$id[3]['id']}">{$name[3]['name']}</option> 
              <option value="{$id[4]['id']}">{$name[4]['name']}</option> 
              <option value="{$id[5]['id']}">{$name[5]['name']}</option> 
              <option value="{$id[6]['id']}">{$name[6]['name']}</option> 
            </select>
            <label for="description2">捡到的物品详细描述</label>
            <textarea class="form-control" rows="4" name="description2" id="description2" placeholder="详细描述"></textarea>
            <label for="contact2">联系方式</label>
            <input class="form-control" type="text" name="contact2" id="contact2" placeholder="长号短号qq等(注明是具体哪种联系方式)">

          <!--可选项-->
      <!-- <label for="adward2">奖励方式(可不填)</label>
            <select class="form-control" id="adward2" name="adward2" placeholder="悬赏"> 
              <option value=""></option>
              <option value="酸奶">酸奶</option>
              <option value="宵夜">宵夜</option>
              <option value="桑果汁">桑果汁</option>
              <option value="手机号">手机号</option>
              <option value="qq号">qq号</option>
              <option value="微信号号">微信号</option>
              <option value="香吻">香吻</option>
            </select>
            <input class="form-control" name="addition2" type="text" value="" placeholder="补充的悬赏(可不填)" >
          -->  
              <label for="uploadPhotos">上传捡到的物品图片(最多五张，每张不得超过3M)</label>
              <input class="form-inline" style="width:300px;height:30px;" type="file" name="photo1">
              <input class="form-inline" style="width:300px;height:30px;" type="file" name="photo2">
              <input class="form-inline" style="width:300px;height:30px;" type="file" name="photo3">
              <input class="form-inline" style="width:300px;height:30px;" type="file" name="photo4">
              <input class="form-inline" style="width:300px;height:30px;" type="file" name="photo5">
              <input class="btn btn-info uploadbtn" id="imageUpload2" type="submit" value="上传" >
          </form>
          </div> 
      </div>
      
    </div>
  </div>
</div>
 <div class="footer">
         <p>红满堂工作室版权所有 盗版必究</p>
      <p>联系工作室:995746872@qq.com(bug反馈)</p>
    </div>
  <script src="__STATIC__/jquery/jquery.min.js"></script>
  <script src="__STATIC__/bootstrap/js/bootstrap.min.js"></script>
  <script type="text/javascript">
    //控制寻物和寻主的板块
    $("#mytab a").click(function(e){
      e.preventDefault();
      $(this).tab('show');
    });

    //表单验证
   function checkPost(e)
   {
      if (e == 1)
      { 
        if(!($("#name1").val()))
        {
          alert("物品名不能为空!");
          //$("#name1").focus();
          return false;
        }
        if(!($("#description1").val()))
        {
          alert("物品详细描述不能为空!");
          //$("#description1").focus();
          return false;
        }
        if(!($("#contact1").val()))
        {
          alert("联系方式不能空!");
          //$("#contact1").focus();
          return false;
        }
      }
      else if(e == 2)
      {
        if(!($("#name2").val()))
        {
          alert("物品名不能为空!");
          //$("#name2").focus();
          return false;
        }
        if(!($("#description2").val()))
        {
          alert("物品详细描述不能为空!");
          //$("#description2").focus();
          return false;
        }
        if(!($("#contact2").val()))
        {
          alert("联系方式不能空!");
          //$("#contact2").focus();
          return false;
        }
      }
    }
              url="__APP__";
    var username;
    var request=new XMLHttpRequest();
       //alert(url + "/Home/ThingLost/index");
        request.open("GET", url + "/Home/ThingLost/index",true);
        // request.setRequestHeader("Content-type","application/x-www-form-urlencoded");
        request.send();
        request.onreadystatechange = function () {
            if (request.readyState == 4 && request.status == 200) {
                var txt = request.responseText;
              username=eval("(" + txt + ")")
                if(username!=null) {
                    document.getElementById("login").innerHTML = username;
                    document.getElementById("login").href = url + "/Home/User/index";
                }

            else {
                    alert("您还没有登录，请先登录");
                    window.location.href = url + "/Home/ThingLost/all";
                }
            }
    }
      document.getElementById("head").innerHTML="首页";
    document.getElementById("head").href=url+ "/Home/ThingLost/all";
      document.getElementById("post").innerHTML=null;
  </script>
</body>
</html>